<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="角色操作">
    <#if (operation.code)??>
        <#assign isEdit = true />
    <#else>
        <#assign isAdd = true />
    </#if>
<body class="input">
<script type="text/javascript">
    $().ready(function () {

        var $validateErrorContainer = $("#validateErrorContainer");
        var $validateErrorLabelContainer = $("#validateErrorContainer ul");
        var $validateForm = $("#validateForm");
        var $tab = $("#tab");

        // Tab效果
        $tab.tabs(".tabContent", {
            tabs:"input"
        });

        // 表单验证
        $validateForm.validate({
            errorContainer:$validateErrorContainer,
            errorLabelContainer:$validateErrorLabelContainer,
            wrapper:"li",
            errorClass:"validateError",
            ignoreTitle:true,
            rules:{
                "operation.code":{
                    required:true,
                    minlength:1,
                    maxlength:20
                },
                "operation.name":{
                    required:true,
                    minlength:2,
                    maxlength:30
                }
            },
            messages:{
                "operation.code":{
                    required:"请填写运营商代码",
                    maxlength:"运营商代码必须小于等于20"
                },
                "operation.name":{
                    required:"请填写运营商名",
                    minlength:"运营商名必须大于等于2",
                    maxlength:"运营商名必须小于等于30"
                }
            },
            submitHandler:function (form) {
                $(form).find(":submit").attr("disabled", true);
                form.submit();
            }
        });
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
    });
</script>
<div class="body">
    <div class="inputBar">
        <h1><span class="icon">&nbsp;</span><#if isAdd??>添加运营商<#else>编辑运营商</#if></h1>
    </div>
    <div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
        <div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
        <ul></ul>
    </div>
    <form id="validateForm" class="validate" method="post"
          action="<#if isAdd??>${web_base}/recharge/operation!add.htm<#else>${web_base}/recharge/operation!update.htm</#if>">
        <table class="inputTable tabContent">
            <tr>
                <th>运营商代码:</th>
                <td>
                    <#if isEdit??>
                    ${(operation.code)!}
                        <input type="text" hidden="hidden" name="operation.code" value="${(operation.code)!}"/>
                    <#else>
                        <input type="text" name="operation.code" value="<#if isEdit??>${(operation.code)!}</#if>"/>
                        <label class="requireField">*</label>
                    </#if>
                </td>
            </tr>
            <tr>
                <th>运营商名:</th>
                <td><input type="text" name="operation.name"
                           value="<#if isEdit??>${(operation.name)!}</#if>"/><label
                        class="requireField">*</label></td>
            </tr>
            <tr>
                <th>是否启用:</th>
                <td>
                    <select name="operation.enable">
                        <option value="true" <#if isEdit?? && operation.enable >selected="selected"</#if> >是
                        </option>
                        <option value="false" <#if isEdit?? && !operation.enable >selected="selected"</#if> >否
                        </option>
                    </select>
                </td>
            </tr>
        </table>
        <div class="buttonArea">
            <input type="submit" class="formButton"
                   value="<#if isAdd??>添加<#else>修改</#if>" hidefocus="true"/>&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回"
                   hidefocus="true"/>
        </div>
    </form>
</body>

</@edit>